﻿/*
 * 文件名:Teaching.cs
 * 类名:XHCTMS.DAL.Teaching
 * 创建人: 杨航
 * 创建时间: 2013-5-21 19:34:30
 *  
 * 最近更新：2013-5-23 15:44:27
 * 备注: 
 * 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace XHCTMS.BLL
{
    /// <summary>
    /// 授课任务
    /// </summary>
    public class Teaching
    {
        /// <summary>
        /// 添加授课任务
        /// </summary>
        /// <param name="teaching">授课任务信息</param>
        /// <returns>返回int类型 1/成功, 0/失败, -1/异常</returns>
        public int AddTeaching(MODEL.Teaching teaching)
        {
            return new DAL.Teaching().Add(teaching);
        }

        /// <summary>
        /// 通过编号删除相关授课任务
        /// </summary>
        /// <param name="teachingId">授课任务编号</param>
        /// <returns>返回int类型 1/成功, 0/失败, -1/异常</returns>
        public int DelTeaching(int teachingId)
        {
            return new DAL.Teaching().Delete(teachingId);
        }

        /// <summary>
        /// 任意条件获取授课任务信息
        /// </summary>
        /// <param name="teachingId">授课任务编号</param>
        /// <returns>返回DataTable类型，null/异常</returns>
        public DataTable SearchTeaching(MODEL.Teaching teaching, int pageSize, int pageIndex)
        {
            return new DAL.Teaching().Search(teaching, pageSize, pageIndex);
        }

        /// <summary>
        /// 通过编号修改授课任务信息
        /// </summary>
        /// <param name="teachingId">授课任务编号</param>
        /// <param name="teaching">授课任务信息</param>
        /// <returns>返回int类型 1/成功, 0/失败, -1/异常</returns>
        public int ReviseTeaching(int teachingId, MODEL.Teaching teaching)
        {
            return new DAL.Teaching().Revise(teachingId, teaching);
        }

        /// <summary>
        /// 修改授课任务状态 1/在授, 0/结课
        /// </summary>
        /// <param name="teachingId">授课任务编号</param>
        /// <param name="IsEndOrOn">授课任务状态 1/在授, 0/结课</param>
        /// <returns>返回int类型 1/成功, 0/失败, -1/异常</returns>
        public int ReviseFlag(int teachingId, int IsEndOrOn)
        {
            return new DAL.Teaching().ReviseFlag(teachingId, IsEndOrOn);
        }

        /// <summary>
        /// 分页获取授课信息
        /// </summary>
        /// <param name="pageSize">页面大小</param>
        /// <param name="pageIndex">当前页号</param>
        /// <returns>返回DataTable null/异常</returns>
        public DataTable Pagination(int pageSize, int pageIndex)
        {
            return new DAL.Teaching().Pagination(pageSize, pageIndex);
        }

        /// <summary>
        /// 获取所有班级名
        /// </summary>
        /// <returns>返回DataTable类型，null/异常</returns>
        public DataTable GetClassName()
        {
            return new DAL.Teaching().GetClassName();
        }

        /// <summary>
        /// 结课
        /// </summary>
        /// <param name="teachingId">授课任务编号</param>
        /// <returns>返回int类型 1/成功, 0/失败, -1/异常</returns>
        public int Guitarlessons(int teachingId)
        {           
            return new DAL.Teaching().ReviseFlag(teachingId, 0);
        }
         /// <summary>
        /// 获取所有教师名
        /// </summary>
        /// <returns>返回DataTable类型，null/异常</returns>
        public DataTable GetTeacherName()
        {
            return new DAL.Teaching().GetTeacherName();
        }

        public string GetCountPage(int pageSize)
        {
            return new DAL.Teaching().GetCountPage(pageSize);
        }

        public DataTable GetCountPage(MODEL.Teaching teaching)
        {
            return new DAL.Teaching().GetCountPage(teaching);
        }

      /// 根据授课老师号查询正在授课的所有班级
        /// </summary>
        /// <param name="teaTeaID"></param>
        /// <returns></returns>
        public DataTable TeaTeaIDFindClass(int teaTeaID)
        {
            return new DAL.Teaching().TeaTeaIDFindClass(teaTeaID);
        }

        
        /// <summary>
        /// 授课老师获得所教班的在授课程
        /// </summary>
        /// <param name="classID"></param>
        /// <param name="teaTeaID"></param>
        /// <returns></returns>
        public DataTable GetTeaching(int classID, int teaTeaID, bool isEnd)
        {
            return new DAL.Teaching().GetTeaching(classID, teaTeaID,isEnd);
        }
    }
}
